package com.mydomain.Bodega;
// Generated 09-oct-2009 21:00:47 by Hibernate Tools 3.2.2.GA

import java.io.Serializable;
import java.util.Date;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import org.hibernate.validator.NotNull;

/**
 * InvCompras generated by hbm2java
 */
@Entity
@Table(name = "inv_compras", schema = "public")
public class InvCompras implements java.io.Serializable {

	private long cmpCodigo;
	private Subdepartamento subdepartamento;
	private Integer depCodigo;
	private Date cmpFecha;
	private Serializable cmpGrabado;
	private Set<InvDetalle> invDetalles = new HashSet<InvDetalle>(0);

	public InvCompras() {
	}

	public InvCompras(long cmpCodigo) {
		this.cmpCodigo = cmpCodigo;
	}
	public InvCompras(long cmpCodigo, Subdepartamento subdepartamento,
			Integer depCodigo, Date cmpFecha, Serializable cmpGrabado,
			Set<InvDetalle> invDetalles) {
		this.cmpCodigo = cmpCodigo;
		this.subdepartamento = subdepartamento;
		this.depCodigo = depCodigo;
		this.cmpFecha = cmpFecha;
		this.cmpGrabado = cmpGrabado;
		this.invDetalles = invDetalles;
	}

	@Id
	@Column(name = "cmp_codigo", unique = true, nullable = false, precision = 10, scale = 0)
	@NotNull
	public long getCmpCodigo() {
		return this.cmpCodigo;
	}

	public void setCmpCodigo(long cmpCodigo) {
		this.cmpCodigo = cmpCodigo;
	}
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "subdep_codigo")
	public Subdepartamento getSubdepartamento() {
		return this.subdepartamento;
	}

	public void setSubdepartamento(Subdepartamento subdepartamento) {
		this.subdepartamento = subdepartamento;
	}

	@Column(name = "dep_codigo", precision = 5, scale = 0)
	public Integer getDepCodigo() {
		return this.depCodigo;
	}

	public void setDepCodigo(Integer depCodigo) {
		this.depCodigo = depCodigo;
	}
	@Temporal(TemporalType.DATE)
	@Column(name = "cmp_fecha", length = 13)
	public Date getCmpFecha() {
		return this.cmpFecha;
	}

	public void setCmpFecha(Date cmpFecha) {
		this.cmpFecha = cmpFecha;
	}

	@Column(name = "cmp_grabado")
	public Serializable getCmpGrabado() {
		return this.cmpGrabado;
	}

	public void setCmpGrabado(Serializable cmpGrabado) {
		this.cmpGrabado = cmpGrabado;
	}
	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "invCompras")
	public Set<InvDetalle> getInvDetalles() {
		return this.invDetalles;
	}

	public void setInvDetalles(Set<InvDetalle> invDetalles) {
		this.invDetalles = invDetalles;
	}

}
